package de.szut.fragments.dialogs;

import android.app.Dialog;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.*;
import android.widget.Button;
import de.szut.logic.Logic;
import de.szut.scene.helper.SceneManager;
import de.szut.scene.scenes.GameScene;
import de.szut.scene.scenes.MenuScene;
import de.szut.splasher.R;

/**
 * Created with IntelliJ IDEA.
 * User: Nils
 * Date: 04.11.13
 * Time: 19:35
 * To change this template use File | Settings | File Templates.
 */
public class StartGameDialog extends DialogFragment {

    private Button loadGameBtn,newGameBtn;
    private Dialog mDialog;

    public StartGameDialog() {
    }

    public static StartGameDialog newInstance() {
        StartGameDialog dlg = new StartGameDialog();
        return dlg;
    }
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View root = inflater.inflate(R.layout.new_game_dlg, container, false);
        mDialog = getDialog();
        mDialog.setCancelable(false);
        mDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
        mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        loadGameBtn = (Button) root.findViewById(R.id.load_game_btn);
        loadGameBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //TODO LOAD GAME
            }
        });
        newGameBtn = (Button) root.findViewById(R.id.new_game_btn);
        newGameBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mDialog.dismiss();
                SceneManager.getInstance().createGameScene();
            }
        });
        return root;
    }

    @Override
    public void onResume() {
        super.onResume();    //To change body of overridden methods use File | Settings | File Templates.
    }
}
